package org.smartercontext.contextmger.utilities;

import java.util.ArrayList;
import java.util.List;

import org.smartercontext.contextmger.DTO.PersonDTO;
import org.smartercontext.contextmger.contextsphere.ContextManagerController;

import com.hp.hpl.jena.ontology.OntResource;
import com.hp.hpl.jena.ontology.impl.OntResourceImpl;
import com.hp.hpl.jena.rdf.model.Literal;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.rdf.model.StmtIterator;

public class GetFriendsAndFamily {
	
	private List<PersonDTO>listFriends;
	
	public GetFriendsAndFamily(){
		listFriends = new ArrayList<>();
	}
	
	public Model deleteFriendsToUserModel(Model usermodel, String username){
		
		String nsUser="http://smartercontext.org/vocabularies/rdf/"+username+".rdf#";
		Resource resource = usermodel.getResource(nsUser+username);
		
		for(int i=0;i<listFriends.size();i++){
			PersonDTO pdto = listFriends.get(i);
			String name = pdto.getName();
			
			List<Statement>stmts = new ArrayList<>();
			StmtIterator iterator = resource.listProperties();
			boolean find = false;
			Statement stmt = null;
			
			while(iterator.hasNext()){
				stmt = iterator.next();
				String object = stmt.getObject().toString();
				
				if(object.equals(nsUser+name)){
					find = true;
				}else{
					stmts.add(stmt);
				}
			}
			
			if(find){
				
				Resource person = usermodel.getResource(nsUser+name);
				usermodel.remove(resource.listProperties().toList());
				usermodel.remove(person.listProperties().toList());
				usermodel.add(stmts);
				
			}
		}
		
		return usermodel;
		
	}
	
	public Model modifyFriendsToUserModel(Model usermodel, String username){
		
		String nsUser="http://smartercontext.org/vocabularies/rdf/"+username+".rdf#";
		Resource resource = usermodel.getResource(nsUser+username);
		
		for(int i=0;i<listFriends.size();i++){
			PersonDTO pdto = listFriends.get(i);
			String newName = pdto.getName();
			String oldname = pdto.getOldName();
			String rel = pdto.getRelationship();
			
			StmtIterator iterator = resource.listProperties();
			
			boolean find = false;
			List<Statement>stmts = new ArrayList<>();
			Statement stmt = null;
			while(iterator.hasNext()){
				stmt = iterator.next();
				String object = stmt.getObject().toString();
				
				if(object.equals(nsUser+oldname)){
					
					find = true;
				}else{
					stmts.add(stmt);
				}
			}
			
			if(find){
			
			Resource person = usermodel.getResource(nsUser+oldname);
			Property prop = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),rel);
			if(newName==null){
				usermodel.remove(resource.listProperties().toList());
				usermodel.add(stmts);
				usermodel.add(resource,prop,person);
			}else{
				usermodel.remove(resource.listProperties().toList());
				usermodel.add(stmts);
				Resource newPerson = usermodel.createResource(nsUser+newName);
				
				List<Statement>listP = person.listProperties().toList();
				usermodel.remove(listP);
				
				for(int j=0;j<listP.size();j++){
					Statement stmt2 = listP.get(j);
					Property ptemp = stmt2.getPredicate();
					RDFNode otemp = stmt2.getObject();
					newPerson.addProperty(ptemp, otemp);
				}
				usermodel.add(resource,prop,newPerson);
				
			}
			Property nullable = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),null);
			resource.removeAll(nullable);
		}
			
		}
		
		return usermodel;
		
	}
	
	public Model addFriendsToUserModel(Model usermodel, String username){
		
		String nsUser="http://smartercontext.org/vocabularies/rdf/"+username+".rdf#";
		Resource resource = usermodel.getResource(nsUser+username);
		
		
		for(int i=0;i<listFriends.size();i++){
			PersonDTO pdto = listFriends.get(i);
			String name = pdto.getName();
			String rel = pdto.getRelationship();
			
			if(rel.equals("friendOf")){
				
				Property friendOf = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"friendOf");
				int quantity = 0;
			if(resource.hasProperty(friendOf)){
				StmtIterator friends = resource.listProperties(friendOf);
				
				while(friends.hasNext()){
					Statement stmt = friends.next();
					String urlObject = stmt.getObject().toString();
					if(urlObject.equals(nsUser+name)){
						quantity++;
					}
				}
			}
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,friendOf,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,friendOf,personNew);
				}
				
			
			}else if(rel.equals("hasAsAunt")){
				Property hasAsAunt = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsAunt");
				int quantity =0;
				if(resource.hasProperty(hasAsAunt)){
					StmtIterator itAunt = resource.listProperties(hasAsAunt);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsAunt,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsAunt,personNew);
				}
				
			}else if(rel.equals("hasAsBrotherInLaw")){
				Property hasAsBrotherInLaw = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsBrotherInLaw");
				int quantity =0;
				if(resource.hasProperty(hasAsBrotherInLaw)){
					StmtIterator itAunt = resource.listProperties(hasAsBrotherInLaw);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsBrotherInLaw,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsBrotherInLaw,personNew);
				}
				
			}else if(rel.equals("hasAsBrother")){
				Property hasAsBrother = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsBrother");
				int quantity =0;
				if(resource.hasProperty(hasAsBrother)){
					StmtIterator itAunt = resource.listProperties(hasAsBrother);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsBrother,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsBrother,personNew);
				}
				
			}else if(rel.equals("hasAsCousin")){
				Property hasAsCousin = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsCousin");
				int quantity =0;
				if(resource.hasProperty(hasAsCousin)){
					StmtIterator itAunt = resource.listProperties(hasAsCousin);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsCousin,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsCousin,personNew);
				}
				
			}else if(rel.equals("hasAsDaugtherInLaw")){
				Property hasAsDaugtherInLaw = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsDaugtherInLaw");
				int quantity =0;
				if(resource.hasProperty(hasAsDaugtherInLaw)){
					StmtIterator itAunt = resource.listProperties(hasAsDaugtherInLaw);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsDaugtherInLaw,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsDaugtherInLaw,personNew);
				}
				
			}else if(rel.equals("parentOf")){
				Property parentOf = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"parentOf");
				int quantity =0;
				if(resource.hasProperty(parentOf)){
					StmtIterator itAunt = resource.listProperties(parentOf);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,parentOf,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,parentOf,personNew);
				}
				
			}else if(rel.equals("hasAsFamilyMember")){
				Property hasAsFamilyMember = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsFamilyMember");
				int quantity =0;
				if(resource.hasProperty(hasAsFamilyMember)){
					StmtIterator itAunt = resource.listProperties(hasAsFamilyMember);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsFamilyMember,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsFamilyMember,personNew);
				}
				
			}else if(rel.equals("childOf")){
				Property childOf = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"childOf");
				int quantity =0;
				if(resource.hasProperty(childOf)){
					StmtIterator itAunt = resource.listProperties(childOf);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,childOf,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,childOf,personNew);
				}
				
			}else if(rel.equals("hasAsFatherInLaw")){
				Property hasAsFatherInLaw = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsFatherInLaw");
				int quantity =0;
				if(resource.hasProperty(hasAsFatherInLaw)){
					StmtIterator itAunt = resource.listProperties(hasAsFatherInLaw);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsFatherInLaw,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsFatherInLaw,personNew);
				}
				
			}else if(rel.equals("hasAsGrandChild")){
				Property hasAsGrandChild = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsGrandChild");
				int quantity =0;
				if(resource.hasProperty(hasAsGrandChild)){
					StmtIterator itAunt = resource.listProperties(hasAsGrandChild);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsGrandChild,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsGrandChild,personNew);
				}
				
			}else if(rel.equals("hasAsGrandMa")){
				Property hasAsGrandMa = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsGrandMa");
				int quantity =0;
				if(resource.hasProperty(hasAsGrandMa)){
					StmtIterator itAunt = resource.listProperties(hasAsGrandMa);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsGrandMa,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsGrandMa,personNew);
				}
				
			}else if(rel.equals("hasAsGrandPa")){
				Property hasAsGrandPa = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsGrandPa");
				int quantity =0;
				if(resource.hasProperty(hasAsGrandPa)){
					StmtIterator itAunt = resource.listProperties(hasAsGrandPa);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsGrandPa,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsGrandPa,personNew);
				}
				
			}else if(rel.equals("hasAsHalfBro")){
				Property hasAsHalfBro = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsHalfBro");
				int quantity =0;
				if(resource.hasProperty(hasAsHalfBro)){
					StmtIterator itAunt = resource.listProperties(hasAsHalfBro);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsHalfBro,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsHalfBro,personNew);
				}
				
			}else if(rel.equals("hasAsHalfSister")){
				Property hasAsHalfSister = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsHalfSister");
				int quantity =0;
				if(resource.hasProperty(hasAsHalfSister)){
					StmtIterator itAunt = resource.listProperties(hasAsHalfSister);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsHalfSister,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsHalfSister,personNew);
				}
			
			}else if(rel.equals("hasAsMotherInLaw")){
				Property hasAsMotherInLaw = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsMotherInLaw");
				int quantity =0;
				if(resource.hasProperty(hasAsMotherInLaw)){
					StmtIterator itAunt = resource.listProperties(hasAsMotherInLaw);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsMotherInLaw,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsMotherInLaw,personNew);
				}
			
			}else if(rel.equals("hasAsNephew")){
				Property hasAsNephew = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsNephew");
				int quantity =0;
				if(resource.hasProperty(hasAsNephew)){
					StmtIterator itAunt = resource.listProperties(hasAsNephew);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsNephew,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsNephew,personNew);
				}
			
			}else if(rel.equals("hasAsNiece")){
				Property hasAsNiece = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsNiece");
				int quantity =0;
				if(resource.hasProperty(hasAsNiece)){
					StmtIterator itAunt = resource.listProperties(hasAsNiece);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsNiece,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsNiece,personNew);
				}
				
			}else if(rel.equals("hasAsSister")){
				Property hasAsSister = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsSister");
				int quantity =0;
				if(resource.hasProperty(hasAsSister)){
					StmtIterator itAunt = resource.listProperties(hasAsSister);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsSister,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsSister,personNew);
				}
				
			}else if(rel.equals("hasAsSisterInLaw")){
				Property hasAsSisterInLaw = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsSisterInLaw");
				int quantity =0;
				if(resource.hasProperty(hasAsSisterInLaw)){
					StmtIterator itAunt = resource.listProperties(hasAsSisterInLaw);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsSisterInLaw,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsSisterInLaw,personNew);
				}
			
			}else if(rel.equals("hasAsSonInLaw")){
				Property hasAsSonInLaw = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsSonInLaw");
				int quantity =0;
				if(resource.hasProperty(hasAsSonInLaw)){
					StmtIterator itAunt = resource.listProperties(hasAsSonInLaw);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsSonInLaw,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsSonInLaw,personNew);
				}
			
			}else if(rel.equals("hasAsStepBrother")){
				Property hasAsStepBrother = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsStepBrother");
				int quantity =0;
				if(resource.hasProperty(hasAsStepBrother)){
					StmtIterator itAunt = resource.listProperties(hasAsStepBrother);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsStepBrother,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsStepBrother,personNew);
				}
			
			}else if(rel.equals("hasAsStepDaugther")){
				Property hasAsStepDaugther = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsStepDaugther");
				int quantity =0;
				if(resource.hasProperty(hasAsStepDaugther)){
					StmtIterator itAunt = resource.listProperties(hasAsStepDaugther);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsStepDaugther,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsStepDaugther,personNew);
				}
			
			}else if(rel.equals("hasAsStepFather")){
				Property hasAsStepFather = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsStepFather");
				int quantity =0;
				if(resource.hasProperty(hasAsStepFather)){
					StmtIterator itAunt = resource.listProperties(hasAsStepFather);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsStepFather,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsStepFather,personNew);
				}
			
			}else if(rel.equals("hasAsStepMother")){
				Property hasAsStepMother = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsStepMother");
				int quantity =0;
				if(resource.hasProperty(hasAsStepMother)){
					StmtIterator itAunt = resource.listProperties(hasAsStepMother);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsStepMother,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsStepMother,personNew);
				}
			
			}else if(rel.equals("hasAsStepSister")){
				Property hasAsStepSister = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsStepSister");
				int quantity =0;
				if(resource.hasProperty(hasAsStepSister)){
					StmtIterator itAunt = resource.listProperties(hasAsStepSister);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsStepSister,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsStepSister,personNew);
				}
			
			}else if(rel.equals("hasAsStepSon")){
				Property hasAsStepSon = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsStepSon");
				int quantity =0;
				if(resource.hasProperty(hasAsStepSon)){
					StmtIterator itAunt = resource.listProperties(hasAsStepSon);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsStepSon,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsStepSon,personNew);
				}
			
			}else if(rel.equals("hasAsUncle")){
				Property hasAsUncle = usermodel.createProperty(ContextManagerController.getNsSchemaPERSONAL(),"hasAsUncle");
				int quantity =0;
				if(resource.hasProperty(hasAsUncle)){
					StmtIterator itAunt = resource.listProperties(hasAsUncle);
					while(itAunt.hasNext()){
						Statement stmt = itAunt.next();
						String urlObject = stmt.getObject().toString();
						if(urlObject.equals(nsUser+name)){
							quantity++;
						}
					}
				}
				
				if(quantity>0){
					Resource personNew = usermodel.createResource(nsUser+name+quantity);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsUncle,personNew);
					
				}else{
					Resource personNew = usermodel.createResource(nsUser+name);
					Property rdfType = usermodel.createProperty(ContextManagerController.getRdf(),"type");
					Property personProp = usermodel.createProperty(ContextManagerController.getNsSchemaGC(),"HumanEntity");
					
					usermodel.add(personNew,rdfType,personProp);
					usermodel.add(resource,hasAsUncle,personNew);
				}
			}
		}
		
		return usermodel;
	}

	public ArrayList<Object> getFriendsAndFamily(Model usermodel, String username){
		
		String nsUser="http://smartercontext.org/vocabularies/rdf/"+username+".rdf#";
		Resource resource = usermodel.getResource(nsUser+username);
				
		StmtIterator iterator=resource.listProperties();
		
		ArrayList<Object>persons = new ArrayList<>();
		
		while(iterator.hasNext()){
			Statement stmt = iterator.next();
			String urlObject = stmt.getObject().toString();
			String urlPredicate = stmt.getPredicate().toString();
						
			//Estaban dentro del if
			if(urlPredicate.contains("friendOf")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Friend", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsSister")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Sister", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsBrother")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Brother", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("childOf")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Parent", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("parentOf")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Child", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsAunt")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Aunt", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsUncle")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Uncle", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsNiece")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Niece", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsNephew")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Nephew", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsCousin")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Cousin", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsGrandMa")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Grand Mother", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsGrandPa")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Grand Father", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsGrandChild")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Grand Child", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsStepSister")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Step Sister", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsStepBrother")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Step Brother", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsStepMother")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Step Mother", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsStepFather")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Step Father", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsStepDaugther")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Step Daugther", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsStepSon")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Step Son", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsSisterInLaw")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Sister in law", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsBroInLaw")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Brother in law", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsMotherInLaw")){
			
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Mother in law", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsFatherInLaw")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Father in law", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsDaugtherInLaw")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Daugther in law", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsSonInLaw")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Son-in-law", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsFamilyMember")){
				
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Simple Family member", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsHalfBro")){
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Half Brother", urlObject);
				persons.add(pdto);
				
			}else if(urlPredicate.contains("hasAsHalfSister")){
				Resource human = usermodel.getResource(urlObject);
				PersonDTO pdto = getPersonData(human, "Half Sister", urlObject);
				persons.add(pdto);
			}
		
		}
		return persons;
		
	}
	
	private PersonDTO getPersonData(Resource human, String relationship, String urlObject){
		
		StmtIterator iterator2 = human.listProperties();
		PersonDTO pdto = new PersonDTO();
		String[]split = urlObject.split("#");
		pdto.setName(split[1]);
		pdto.setRelationship(relationship);
		while(iterator2.hasNext()){
			Statement stmt2 = iterator2.next();
			
			if(stmt2.getPredicate().toString().contains("facebookId")){
			
			Literal lt = stmt2.getLiteral();
			pdto.setFacebookId(lt.getString());
			
			}
			
		}
		
		return pdto;
		
	}

	public List<PersonDTO> getListFriends() {
		return listFriends;
	}

	public void setListFriends(List<PersonDTO> listFriends) {
		this.listFriends = listFriends;
	}
	
	
}
